package com.orange.common.android.activity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;

public class PPActivity extends Activity
{
  private static final int ACTION_TAKE_PHOTO = 1000;
  private static final String TAG = "PPActivity";
  ProgressDialog progressDialog;
  Bitmap takePhotoBitmap = null;

  private void savePhotoTaken(Intent paramIntent)
  {
    Bundle localBundle = paramIntent.getExtras();
    if (localBundle == null);
    while (true)
    {
      return;
      this.takePhotoBitmap = ((Bitmap)localBundle.get("data"));
    }
  }

  private void takePhoto(int paramInt)
  {
    startActivityForResult(new Intent("android.media.action.IMAGE_CAPTURE"), paramInt);
  }

  public ProgressDialog getProgressDialog()
  {
    return this.progressDialog;
  }

  public void hideDialog()
  {
    if (this.progressDialog != null)
    {
      Log.d("PPActivity", "hide progress dialog");
      this.progressDialog.cancel();
      this.progressDialog.dismiss();
    }
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    if (paramInt1 == 1000)
      savePhotoTaken(paramIntent);
  }

  public void showProgressDialog(int paramInt1, int paramInt2)
  {
    Resources localResources = getResources();
    showProgressDialog(localResources.getString(paramInt1), localResources.getString(paramInt2));
  }

  public void showProgressDialog(String paramString1, String paramString2)
  {
    showProgressDialog(paramString1, paramString2, null);
  }

  public void showProgressDialog(String paramString1, String paramString2, AsyncTask paramAsyncTask)
  {
    this.progressDialog = ProgressDialog.show(this, paramString1, paramString2);
    if (paramAsyncTask == null);
    while (true)
    {
      return;
      this.progressDialog.setCancelable(true);
      1 local1 = new DialogInterface.OnCancelListener(this, paramAsyncTask)
      {
        public void onCancel()
        {
          boolean bool = this.val$task.cancel(true);
          Log.d("PPActivity", "<showProgressDialog> onCancelListener is fired, task cancel result is " + bool);
        }
      };
      this.progressDialog.setOnCancelListener(local1);
    }
  }

  public void takePhoto()
  {
    takePhoto(1000);
  }
}